<template>
    <div>
        <div v-if="!isLogin">
            <h2>练习1-请登陆</h2>
            <br/>
            <input placeholder="请输入用户名" v-model="username"/>
            <br/>
            <input placeholder="请输入密码" v-model="password" type="password"/>
            <br/>
            <button @click="loginHandler">登陆</button>
        </div>
        <div v-else>
            <p>练习1-欢迎{{username}},您的密码是{{password}}</p>
        </div>
    </div>
</template>

<script>
    export default {
        name: "test-index",
        data() {
            return {
                isLogin: false,
                username: '',
                password: ''
            }
        },
        methods:{
            loginHandler(){
                this.isLogin = true
            }
        }
    }
</script>

<style scoped>

</style>
